#include <stdio.h>
int main()
{
    int n,a,b;
    while (scanf("%d",&n)!=EOF)
    {
        if (n==0)break;
        scanf("%d",&a);
        n--;
        while (n--)
        {
            scanf("%d",&b);
            a^=b;
        }
        printf("%d\n",a);
    }
    return 0;
}
